<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="addfiltr_files/filelist.xml">
<title>Addfilter </title>
<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:Zoom>BestFit</w:Zoom>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-alt:Tahoma;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:536871559 0 0 0 415 0;}
@font-face
	{font-family:"MS Sans Serif";
	panose-1:0 0 0 0 0 0 0 0 0 0;
	mso-font-alt:"Times New Roman";
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:auto;
	mso-font-signature:0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
p
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
pre
	{margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
	font-size:10.0pt;
	font-family:"Courier New";
	mso-fareast-font-family:"Times New Roman";}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
</style>
<![endif]-->
</head>

<body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>

<div class=Section1>

<h2><span class=SpellE><span style='font-family:Verdana'>Addfilter</span></span><span
style='font-family:Verdana'> <o:p></o:p></span></h2>

<h3><span style='font-family:Verdana'>SUMMARY<o:p></o:p></span></h3>

<p><span class=SpellE><span style='font-size:10.0pt;font-family:Verdana'>Addfilter</span></span><span
style='font-size:10.0pt;font-family:Verdana'> is a command-line application which
adds and removes filter drivers for a given drive or volume. It is intended to
demonstrate how to insert a filter driver into the driver stack of a device.
The sample illustrates how to do this by using the <span class=SpellE>SetupDi</span>
APIs. The sample works on the <span class=GramE>x86 platform</span>. It has
only been tested in a 32-bit environment. Since <span class=SpellE>Addfilter</span>
is not a driver, it does not deal with Plug and Play or Power Management. <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>No INF file is needed to
install this application. <o:p></o:p></span></p>

<h3><span style='font-family:Verdana'>BUILDING THE SAMPLE<o:p></o:p></span></h3>

<p><span style='font-size:10.0pt;font-family:Verdana'>Enter the checked or free
build environment. Then, while in the <span class=SpellE>Addfilter</span>
sample directory, type <b>build</b>. A successful build produces the executable
Addfilter.exe. <o:p></o:p></span></p>

<h3><span style='font-family:Verdana'>RELEASE NOTES<o:p></o:p></span></h3>

<p><span style='font-size:10.0pt;font-family:Verdana'>1. This initial sample
does not check the filter for validity before it is added to the driver stack.
If an invalid filter is added, the specified device may no longer be
accessible. <o:p></o:p></span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:Verdana'>Important:</span></b><span
style='font-size:10.0pt;font-family:Verdana'> If you attempt to add a
non-existent filter to a boot device and then reboot, the system may show the
error message INACCESSIBLE_BOOT_DEVICE. If this happens, you will be unable to
start the computer. To fix this, when the boot menu is displayed at startup, go
to the Advanced Options screen and select <b>Use Last Known Good Profile</b>. <o:p></o:p></span></p>

</blockquote>

<p><span style='font-size:10.0pt;font-family:Verdana'>If you attempt to add a
non-existent filter to a normal (non-boot) device (CD drive, floppy drive,
etc.), you will need to go into the Device Manager, uninstall the device,
reboot, and re-add the device from Add Hardware. Also, be careful not to add a
filter to a driver with which it is not designed to operate. Unpredictable
results may ensue. <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>2. The sample is intended
for use with upper filter drivers only. <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>3. When you add a filter
to a device, that device needs to be restarted. Depending on the device, this
may necessitate restarting your computer. The <span class=SpellE><b>RestartDevice</b></span>
function (in <span class=SpellE>Addfilter.c</span>) stops the specified device
and then restarts it. If the device has been stopped but not restarted, and the
machine is restarted, the reboot will not necessarily restart the device. You
will need to call the <span class=SpellE><b>RestartDevice</b></span> function
to restart your device. <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>4. Since the sample
currently enumerates only disk devices, the sample can only operate on devices
of this class. One way in which you could extend this sample code is by adding
another command-line argument that handles other device types. <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>5. The sample runs in
user mode only. <o:p></o:p></span></p>

<p><b><span style='font-size:10.0pt;font-family:Verdana'>Usage:</span></b><span
style='font-size:10.0pt;font-family:Verdana'> <span class=SpellE>addfilter</span>
[/<span class=SpellE>listdevices</span>] [/device <span class=SpellE>device_name</span>]
[/add filter] [/remove filter] <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>If the device name is not
supplied, settings will apply to all devices. <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>If there is no /add or
/remove argument, a list of currently installed drivers will be printed. <o:p></o:p></span></p>

<h3><span style='font-family:Verdana'>CODE TOUR<o:p></o:p></span></h3>

<h4><span style='font-family:Verdana'>File Manifest<o:p></o:p></span></h4>

<pre><u>File<span style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Description<o:p></o:p></u></pre><pre><o:p>&nbsp;</o:p></pre><pre><span
class=SpellE>Addfilter.c</span><span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp; </span>Main source file</pre><pre><span
class=SpellE>Addfilter.rc</span><span style='mso-tab-count:1'>&nbsp;&nbsp; </span>Version resource file</pre><pre>Sources<span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Sources file</pre><pre><span
class=SpellE>Makefile</span><span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
class=SpellE>Makefile</span></pre><pre><o:p>&nbsp;</o:p></pre><pre><o:p>&nbsp;</o:p></pre>

<p align=center style='text-align:center;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New"'><a href="#top"><span
style='font-family:Verdana'>Top of page</span></a></span><span
style='font-size:10.0pt;font-family:Verdana;mso-bidi-font-family:"Courier New"'>
<o:p></o:p></span></p>

<pre><o:p>&nbsp;</o:p></pre>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=624
 style='width:6.5in;mso-cellspacing:0in;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes;
  height:1.5pt'>
  <td style='background:aqua;padding:.75pt .75pt .75pt .75pt;height:1.5pt'>
  <p class=MsoNormal><o:p>&nbsp;</o:p></p>
  </td>
 </tr>
</table>

<pre><o:p>&nbsp;</o:p></pre><pre><o:p>&nbsp;</o:p></pre>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:7.5pt;font-family:"MS Sans Serif";mso-bidi-font-family:"Courier New"'>&copy;
2004</span><span style='font-size:10.0pt;font-family:Verdana;mso-bidi-font-family:
"Courier New"'> </span><span style='font-size:7.5pt;font-family:"MS Sans Serif";
mso-bidi-font-family:"Courier New"'>Microsoft Corporation </span><span
style='font-size:10.0pt;font-family:Verdana;mso-bidi-font-family:"Courier New"'><o:p></o:p></span></p>

</div>

</body>

</html>

